
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<br/>

<h2> Your Profile </h2>
<?
  include("sqlconnect.php");
  session_start();
  
  $usrid = $_SESSION['usrid'];
  
  
  $query= "SELECT * FROM users where user_id = $usrid ";
  
  $result= mysql_query($query) or die(mysql_error());
  
  $num = (mysql_num_rows($result));
  
  $row = mysql_fetch_object($result);
  
  $email_id = $row->email_id;
  $user_dob = $row->user_dob;
  $fname = $row->user_fname;
  $lname = $row->user_lname;
  $sec_q = $row->sec_q;
  $sec_a = $row->sec_a;


if(isset($_POST['edit']))
{
print '
<form action="updateprofilerecord.php" method="post" name="updateform">
<table width="376" border="1">
  <tr>
    <th width="83" scope="row">Email ID:</th>
    <td width="277"><input name="email_id" type="text"   value="'.$email_id.'" /><br /></td>
  </tr>
  
  <tr>
    <th scope="row">Date of Birth:</th>
    <td><input name="user_dob" type="text"   value="'.$user_dob.'" /></td>
  </tr>
  <tr>
    <th scope="row">First Name:</th>
    <td><input name="fname" type="text"   value="'.$fname.'"/><br /></td>
  </tr>
  <tr>
    <th scope="row">Last Name:</th>
    <td><input name="lname" type="text"   value="'.$lname.'"/></td>
  </tr>
  <tr>
    <th scope="row">Security Question:</th>
    <td><input name="sec_q" type="text"   size="50" value="'.$sec_q.'"/></td>
  </tr>
  <tr>
    <th scope="row">Security Answer:</th>
    <td><input name="sec_a" type="text"   value="'.$sec_a.'" /></td>
  </tr>

</table>
<input type="submit" name="editsubmit" id="button" value="Submit for Update">

</form> ';

}else{
 print '
<form action="'.$PHP_SELF.'" method="post" name="updateform">
<table width="376" border="1">
  <tr>
    <th width="83" scope="row">Email ID:</th>
    <td width="277"><input name="email_id" type="text" readonly="true" value="'.$email_id.'" /><br /></td>
  </tr>
  
  <tr>
    <th scope="row">Date of Birth:</th>
    <td><input name="user_dob" type="text" readonly="true" value="'.$user_dob.'" /></td>
  </tr>
  <tr>
    <th scope="row">First Name:</th>
    <td><input name="fname" type="text" readonly="true" value="'.$fname.'"/><br /></td>
  </tr>
  <tr>
    <th scope="row">Last Name:</th>
    <td><input name="lname" type="text" readonly="true" value="'.$lname.'"/></td>
  </tr>
  <tr>
    <th scope="row">Security Question:</th>
    <td><input name="sec_q" type="text" readonly="true" size="50" value="'.$sec_q.'"/></td>
  </tr>
  <tr>
    <th scope="row">Security Answer:</th>
    <td><input name="sec_a" type="text" readonly="true" value="'.$sec_a.'" /></td>
  </tr>

</table>
<input type="submit" name="edit" id="button" value="Edit Profile">
</form> <br>';

//$_SESSION['edit'] = 1;

  }
?>
<a href="home.php" title="backhome">Back To Home</a><br>
</body>
</html>
